package org.zhxy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.util.StringUtils;
import org.zhxy.model.entity.Grade;
import org.zhxy.service.GradeService;
import org.zhxy.mapper.GradeMapper;
import org.springframework.stereotype.Service;

/**
 * @author walter
 * @description 针对表【tb_grade】的数据库操作Service实现
 * @createDate 2025-07-01 21:14:35
 */
@Service
public class GradeServiceImpl extends ServiceImpl<GradeMapper, Grade> implements GradeService {

    // 分页条件查询年级信息
    @Override
    public IPage<Grade> page(IPage<Grade> page, String gradeName) {
        LambdaQueryWrapper<Grade> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(StringUtils.hasText(gradeName), Grade::getName, gradeName);
        wrapper.orderByDesc(Grade::getId);
        return page(page, wrapper);
    }
}




